<#include "/includes/vars.inc"> 
<@pp.dropOutputFile />
<#list entities.entity as entity>
    <@pp.changeOutputFile name="${webDir}/jeecode/"+entity.@name?uncap_first+"/include/"+entity.@name?cap_first+"Create.xhtml" />
        <#assign entityName = entity.@name>
        <#assign managedBean = entity.@name?uncap_first+"Controller">
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
    <ui:composition>

        <p:dialog header="${r"#{"}msg.create${r"}"} ${r"#{"}msg.${entityName?uncap_first}Title${r"}"}"
                  position="center"
                  widgetVar="${entityName}CreateDialog"
                  resizable="false"
                  width="600"
                  modal="true">
            <p:messages id="errors"
                        redisplay="false" />
            <h:panelGroup id="data">
                <h:panelGrid columns="2" cellpadding="5">
                    <ui:include src="/jeecode/${entityName?uncap_first}/include/${entityName}DataEdit.xhtml" />
                </h:panelGrid>
                <p:separator />
                <p:commandButton update="errors,<#if entity.@parent[0]??>:tab${entity.@parent}</#if>:form${entityName}List:data"
                                 icon="ui-icon ui-icon-disk"
                                 actionListener="${r"#{"}${managedBean}${r".save}"}"
                                 oncomplete="handle${entityName}CreateDialog(xhr, status, args)" 
                                 value="${r"#{"}msg.save${r"}"}"
                                 />
                <p:spacer width="5" />  
                <p:commandButton onclick="${entityName}CreateDialog.hide();"
                                 icon="ui-icon ui-icon-close"
                                 value="${r"#{"}msg.cancel${r"}"}"
                                 immediate="true"
                                 update="errors"/>
            </h:panelGroup>
            <script type="text/javascript">
            function handle${entityName}CreateDialog(xhr, status, args) {  
                if(!(args.validationFailed)) {
                    ${entityName}CreateDialog.hide();
                }
            }
            </script>
        </p:dialog>
    </ui:composition>
</html>

</#list>